<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

//Route::get('/', function () {
//    return view('welcome');
//});

//Auth::routes();

Route::get('/', 'HomeController@index')->name('home');

Route::get('vdong', 'VdongController@index')->name('vdong');

Route::get('cache', function () {
//    cache()->put('key', 'aaaaaaaaaaa', 60);
    return cache('key', 'default value');
});

// Routes/web.php in the *consuming application*
//Route::get('password-grant-auth', function () {
//    $http = new GuzzleHttp\Client;
//// Make call to "Tweeter," our Passport-powered OAuth server
//    $response = $http->post('http://cms.test:8080/oauth/token', [
//        'form_params' => [
//            'grant_type' => 'password',
//            'client_id' => 3,
//            'client_secret' => 'j9wnNFPB8GQ5eUbunyP9VDYc51WkW6L3kS4TtNR0',
//            'username' => 'sunvdong@qq.com',
//            'password' => 'admin123456',
//            'scope' => '',
//        ],
//    ]);
//    $thisUsersTokens = json_decode((string)$response->getBody(), true);
//    return $thisUsersTokens;
//// Do stuff with the tokens
//});

//Route::get('members/{id}', 'MembersController@show')->name('members.show');
//
//Route::get('/dong', function () {
////    return URL::route('invitations', ['invitation' => 12345, 'answer' => 'yes']);
////    return URL::signedRoute('invitations', ['invitation' => 12345, 'answer' => 'yes']);
//    return URL::temporarySignedRoute('invitations', now()->addMinutes(4), ['invitation' => 12345, 'answer' => 'yes']);
////    return view('dong')->with(['aa'=>'aaaaaaaaa']);
//});

//Route::prefix('shy')->group(function () {
//    Route::get('/', function () {
//        return 'shy';
//    });
//
//    Route::get('kk', function () {
//        return 'shy/kk';
//    });
//
//    Route::namespace('Shy')->group(function () {
//        // App\Http\Controllers\Shy\PurchasesController
//        Route::get('purchases', 'PurchasesController@index');
//    });
//});

//Route::name('users.')->prefix('users')->group(function () {
//    Route::name('comments.')->prefix('comments')->group(function () {
//        Route::get('{id}', function ($id) {
//            return 'u->m: ' . $id;
//        })->name('show');
//    });
//});

//Route::name('aa.')->group(function () {
//    Route::get('kk', function () {
//        return 'aa.cc';
//    })->name('cc');
//});

//Route::view('/dong', 'dong', [
//    'key' => '<p class="card-text">Text</p>',
//    'variable' => ['aa' => 'dss', 'bb' => 'asd']
//]);

//Route::view('/dong', 'dong', ['key' => 'keyyyyyyyyyyyyy']);

//Route::get('invitations/{invitation}/{answer}', 'InvitationController')
//    ->name('invitations')
//    ->middleware('signed');

//Route::get('/', 'TasksController@index');

//Route::get('tasks/create', 'TasksController@create');
//Route::post('tasks', 'TasksController@store');

//Route::apiResource('myApiResource', 'MyApiResourceController');

//Route::view('/apply', 'apply', ['content' => 'ssss']);

//Route::get('task', 'TasksController');


//Route::fallback(function () {
//    return '200 && 404';
//});

Auth::routes();

Route::get('/home', 'HomeController@index')->name('home');
